import request from '@/utils/request'

// 校验分片是否已经上传
export function checkMd5(md5) {
    return request({
        url: '/file/checkChunk?md5=' + md5,
        method: 'get'
    })
}

// 合并分片
export function mergeChunk(chunk) {
    return request({
        url: '/file/mergeChunk',
        method: 'post',
        data: chunk,
    })
}

// 上传视频的分片
export function uploadChunk(form) {
    return request({
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
            'hasContentType': '1',
        },
        url: '/file/uploadChunk',
        method: 'post',
        data: form,
        // data: {
        //     file: chunk,
        //     chunk: form,
        // }
    })
}

// 上传视频的分片
export function uploadPic(form) {
    return request({
        url: '/file/uploadPic',
        method: 'post',
        data: form,
    })
}


// 测试方法
export function getFileList() {
    return request({
        url: '/fileList',
        method: 'get'
    })
}

export function downloadAll(data) {
    return request({
        url: '/download',
        method: 'post',
        data: data,
        responseType: "blob",
    })
}
